@using BootBlazor.Servers.Data
@using BootBlazor.Servers.Resources
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.EntityFrameworkCore
@using Microsoft.Extensions.Localization
@using MudBlazor

@inject ISnackbar _snackbarService;
@inject IDbContextFactory<BootBlazorDbContext> _dbFactory;
@inject IStringLocalizer<CommonComponent> _loc;

<MudDialog Gutters="false">
    <DialogContent>
        <div style="width:400px;" class="px-6 py-2">
            <div class="d-flex align-center">
                <MudIcon Icon="@Icons.Material.Filled.Warning" Size="Size.Medium" Class="mr-2"></MudIcon>
                <MudText Typo="Typo.h6">
                    @_loc["ConfirmInputPassword"]
                </MudText>
            </div>

            <div class="d-flex align-center mt-6">
                <EditForm Model="_passwordModel" OnValidSubmit="ConfirmPassword" style="width:100%;">
                    <DataAnnotationsValidator />
                    <MudTextField @bind-Value="_passwordModel.Password" Variant="Variant.Outlined" Margin="Margin.Dense"
                                  Label="@_loc["PasswordHelpText"]" For="@(() => _passwordModel.Password)"
                                  InputType="InputType.Password" UserAttributes="_inputAttributes"
                                  AdornmentIcon="@Icons.Material.Filled.Password"></MudTextField>
                    <div class="mt-4 d-flex">
                        <MudSpacer />
                        <MudButton Variant="Variant.Filled" FullWidth="false" Color="Color.Primary" Size="Size.Medium"
                                   ButtonType="ButtonType.Submit" StartIcon="@Icons.Material.Filled.Check">
                            @_loc["ConfirmInputPasswordButtonText"]
                        </MudButton>
                    </div>
                </EditForm>
            </div>

        </div>
    </DialogContent>
</MudDialog>
